package com.yaoxian.api.service.impl;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.yaoxian.api.domain.UserEntity;
import com.yaoxian.api.feign.OrderServiceFeign;
import com.yaoxian.service.api.OrderService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
	* @author YaoXian
	* @title: OrderServiceImpl
	* @projectName 微服务项目架构
	* @description: TODO
	* @date 2020-07-04 15:58
	*/
@RestController
public class OrderServiceImpl implements OrderService {
		@Resource
		private OrderServiceFeign orderServiceFeign;
		
		@Override
		@RequestMapping(path = "/orderToMember")
		public String orderGetMember(String username) {
				System.out.println(username);
				UserEntity userEntity = orderServiceFeign.getMember(username);
				return userEntity.getUsername() + "订单服务调用会员服务成功";
		}
		
		@Override
		@HystrixCommand(fallbackMethod = "fallBack")
		@RequestMapping(path = "/testHystrix")
		public String testHystrix() {
				
				return null;
		}
		
		
}
